#include <iostream>
#include <cstring>
#include <set>
using namespace std;
int cnt[26];
int main() {
	cin.sync_with_stdio(false);
	string passwd, message;
//	freopen("in.txt", "r", stdin);
	while (cin>>passwd>>message) {
		set<char> s;
		int len=passwd.length();
		for (int i=0; i<len; ++i) s.insert(passwd[i]);
		string result="";
		len=message.length();
		for (int i=0; i<len; ++i) {
			if (s.count(message[i])) result+=message[i];
		}
		for (int i=0; i<26; ++i) cnt[i]=0;
		len=message.length();
		int len_p=passwd.length();
		int st=0;
		bool flag=true;
//		cout<<passwd<<"--vs--"<<result<<endl;
		for (int i=0; i<len; ++i) {
			if (message[i]==passwd[st]) {
				++st;
				continue;
			}
			if (st==len_p) break;
			s.clear();
			for (int j=st+1; j<len_p; ++j) s.insert(passwd[j]);
			if (s.count(message[i])) {
				flag=false;
				break;
			}
		}
		if (st!=len_p) flag=false;
		if (flag) cout<<"PASS"<<endl;
		else cout<<"FAIL"<<endl;
	}
	return 0;
}
